package com.miandian.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.miandian.common.R;
import com.miandian.entities.Madejob;
import com.miandian.entities.Time;
import com.miandian.service.MadejobService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
@RestController
@RequestMapping("/api/madejob")
public class MadejobController {
    @Autowired
    private MadejobService madejobService;

    @GetMapping("/dictionary")
    public R dictionary(){
        Page pageInfo = new Page(1,100);
        LambdaQueryWrapper<Madejob> queryWrapper = new LambdaQueryWrapper<>();
        madejobService.page(pageInfo,queryWrapper);
        return R.success(pageInfo.getRecords());
    }
    @GetMapping("/getList")
    public R getList(){
        Page pageInfo = new Page(1,100);
        LambdaQueryWrapper<Madejob> queryWrapper = new LambdaQueryWrapper<>();
        madejobService.page(pageInfo,queryWrapper);
        return R.success(pageInfo);
    }
    @DeleteMapping("/delete")
    public R delete(@RequestParam List<Integer> ids){
        madejobService.removeByIds(ids);
        return R.success("删除成功");
    }
    @PostMapping("/save")
    public R save(@RequestBody Madejob madejob){
        madejobService.save(madejob);
        return R.success("新增成功");
    }
}
